package model

import (
	"encoding/json"
)

const MenuTypeMenu = "menu"
const MenuTypeButton = "btn"

type Menu struct {
	BaseModel
	ParentId  uint64          `json:"parentId" gorm:"type:bigint(20);column:parent_id"`
	Path      string          `json:"path" gorm:"type:varchar(128);column:path"`
	Name      string          `json:"name" gorm:"type:varchar(128);column:name"`
	Type      string          `json:"type" gorm:"type:varchar(10);column:type"`
	BtnPower  string          `json:"btnPower" gorm:"type:varchar(128);column:btn_power"`
	MenuSort  int             `json:"menuSort" gorm:"type:int;column:menu_sort"`
	Component string          `json:"component" gorm:"type:varchar(128);column:component"`
	Redirect  string          `json:"redirect" gorm:"type:varchar(128);column:redirect"`
	Meta      json.RawMessage `json:"meta" gorm:"type:json;column:meta"`
	Children  []*Menu         `json:"children" gorm:"-"`
}

type MenuRole struct {
	RoleId uint64 `json:"roleId" gorm:"type:bigint(20);column:role_id"`
	MenuId uint64 `json:"menuId" gorm:"type:bigint(20);column:menu_id"`
}
